~Frank Oplumarettu commented on Jan 6, 2012

Constructor Overloading

Derived classes can have different signatures for their constructors than base classes.

For example:

Class ClassA

Private m_s As String

Sub new (s As String)

m_s="baseclass"

End Sub

Function getS As String

getS = m_s

End Function

End Class

Class ClassB As ClassA

Sub new(s As String, n As Integer), ClassA(s)

m_s=s & Cstr(n+1)

End Sub

End Class

And, in some button somewhere:

Dim x As ClassB

Set x = New ClassB("hello",3)

Msgbox(x.getS)

Works just fine.